//
//  NSScreen+Ext.swift
//  TTCOM-macOS
//
//  Created by Toj on 4/19/21.
//

import Foundation

public extension NSScreen {
    
    static var tt_mainDisplayID: CGDirectDisplayID {
        return CGMainDisplayID()
    }
    
    static var tt_currentDisplayID: CGDirectDisplayID {
        let displayID = NSScreen.main?.tt_currentDisplayID ?? tt_mainDisplayID
        
        return displayID
    }
    
    var tt_currentDisplayID: CGDirectDisplayID {
        var displayID = CGMainDisplayID()
        if let currentID = deviceDescription[NSDeviceDescriptionKey("NSScreenNumber")] as? CGDirectDisplayID {
            displayID = currentID
        }
        
        return displayID
    }
    
    var visibleSize: CGSize {
        return NSScreen.main?.visibleFrame.size ?? .zero
    }
    
    var visibleWidth: CGFloat {
        return visibleSize.width
    }
    
    var visibleHeight: CGFloat {
        return visibleSize.height
    }
}
